const express = require("express")

const app = express()

app.get('*', function(req, res, next) {
  //设置允许跨域的域名，*代表允许任意域名跨域
  res.header("Access-Control-Allow-Origin", "*");
  res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS,PATCH");
  res.header('Access-Control-Allow-Headers', 'Content-type');
  res.header('Access-Control-Allow-Headers', 'X-Requested-With');
  res.header('Access-Control-Max-Age',1728000);//预请求缓存20天
  next(); 
})

app.use(express.static('./app1'))

app.listen(9091, () => {
  console.log("app1 at port 9091");
})